package com.luych.toolbox.data.service.dao;

import com.luych.toolbox.common.enums.DataSourceStatus;
import com.luych.toolbox.data.service.entity.DataSource;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.Optional;

public interface DataSourceDao extends JpaRepository<DataSource, String>, JpaSpecificationExecutor<DataSource> {

    Optional<DataSource> findByName(String name);

    Page<DataSource> findByNameLikeOrHostLikeOrDbLike(String name, String host, String db, Pageable pageable);

    Long countByStatus(DataSourceStatus status);

}